﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddService.aspx.cs" Inherits="AddService" MasterPageFile="~/Site.master" %>

<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="BodyContent">
    <div class="contentfull">
        <div class="breadcrumbs">
            <ul id="crumbs">
                <li><a title="My Account" href="/account/">My Account</a>
                    <img src="Content/Images/separator.png" alt="&rarr;" class="separator">
                    Buttons 			</li>
            </ul>
        </div>

        <div id="showMessages"></div>


        <div class="top">
            <div class="innerleft">
                <h1>Create a Button</h1>
            </div>
        </div>
        <div class="content">
            <form method="post" action="ServiceCreated.aspx">
                <input type="hidden" name="action" value="createservice2" />
                <h2 class="large">What will app-users do with this button?</h2>
                <span class="lower_comment same">Configure the way your scans will be processed.</span>
                <fieldset><legend></legend>

                    <div class="divradioset" id="serviceRadioSet">
                        <input name="servicetype" value="record" type="radio" id="radioRecord" class="showradio" />
                        <label for="radioRecord">Record Scans</label>
                        <span class="lower_comment">Save barcode values after scanning.</span>
                        <div class="showdiv">
                            <label>Where would you like to store your recorded scans?</label>
                            <div class="divradioset">
                                <input name="servicesubtype" value="record" type="radio" id="radioRealtimeRecord" />
                                <label for="radioRealtimeRecord">Online in Real-Time</label>
                                <span class="lower_comment">Scans are saved to our servers.  If Internet connectivity is unstable, the app user can choose to save scans on-device.</span>
                                <input name="servicesubtype" value="ondevicerecord" type="radio" id="radioOnDeviceRecord" />
                                <label for="radioOnDeviceRecord">On-Device and Later Sync Online</label>
                                <span class="lower_comment">Scans are saved to the mobile device, and then uploaded later at your discretion.</span>
                            </div>
                        </div>

                        <input name="servicetype" value="database" type="radio" id="radioDatabase" class="showradio" />
                        <label for="radioDatabase">Validate Scans with a Roster</label>
                        <span class="lower_comment">Check each scanned barcode against a Roster.</span>
                        <div class="showdiv">
                            <label>Where would you like the validation to happen?</label>
                            <div class="divradioset">
                                <input name="servicesubtype" value="database" type="radio" id="radioRealtimeDatabase" />
                                <label for="radioRealtimeDatabase">Online in Real-Time</label>
                                <span class="lower_comment">Scans validate against our servers.</span>
                                <input name="servicesubtype" value="ondevicedatabase" type="radio" id="radioOnDeviceDatabase" checked>
                                <label for="radioOnDeviceDatabase">On-Device and Later Sync Online</label>
                                <span class="lower_comment">Your Roster is downloaded to the device before scanning and validated locally. Scan results are uploaded later at your discretion.</span>
                            </div>
                            <label>What Roster would you like to validate your scans against?</label><div class="indent2">
                                <span id="chooseADatabaseSpan">
                                    <label for="database" style="display: inline;">Database:</label>
                                    <select name="database" id="database" class="selectbox">
                                       <%-- <option selected disabled>Choose a Database</option>
                                        <option value="200223">Ticketing</option>
                                        <option value="200224">Database Builder Demo</option>
                                        <option value="200225">Security</option>
                                        <option value="200226">Asset Tracking</option>
                                        <option value="200227">Safety Status</option>
                                        <option value="200228">Attendance</option>
                                        <option value="200229">Scan to Order</option>
                                        <option value="205631">Dkumartest</option>
                                        <option value="209231">test12345</option>
                                        <option value="211223">newdb12345</option>
                                        <option value="211225">sadsadsad</option>--%>
                                        <%=this.GetDatabaseString() %>
                                    </select>
                                </span>
                                <span id="newDatabaseNameInput" style="display: none;">
                                    <input type="hidden" class="inputed" id="newDatabaseNameFlag" name="newDatabaseNameFlag" value="0" />
                                    <label for="newDatabaseName" style="display: inline;">Enter new roster name:</label><br />
                                    <input type="text" class="inputed" name="newDatabaseName" />
                                </span>
                                or 
	<a id="newDatabaseNameA1" href="">create a new one</a><a id="newDatabaseNameA2" href="#" style="display: none;">choose among existing</a>.
                            </div>
                            <label>What should be the status of duplicate scans?</label>
                            <div class="divradioset">
                                <input type="radio" name="duplicateValue" id="duplicateValue1" value="1" />
                                <label for="duplicateValue1">Valid</label>
                                <span class="lower_comment">A duplicate scan will have a valid result.</span>
                                <input type="radio" name="duplicateValue" id="duplicateValue0" checked value="0" />
                                <label for="duplicateValue0">Invalid</label>
                                <span class="lower_comment">A duplicate scan will have an invalid result.</span>
                            </div>
                            <label>Would you also like to use a pattern to validate scans not in the roster?</label>
                            <div class="divradioset" id="showMaskRadioSet">
                                <input type="checkbox" id="mask" class="showradio" name="enableScanMask">
                                <label for="mask">Apply a Validation Pattern</label>
                                <span class="lower_comment">You can define the pattern using a simple code match, or regular expression.</span>


                                <div class="showdiv">
                                    <div id="showMask" style="width: 75%">
                                        <div id="showMask2" class="input">

                                            <input type="checkbox" name="regexMask" id="regexMask" value="1">
                                            <label for="regexMask">Use Regular Expression</label>
                                            <br>
                                            <br>

                                            <label for="maskRule" class="normal" id="patternHeader" style="">Code Pattern</label>
                                            <label for="maskRule" class="normal" id="regexHeader" style="display: none;">Regular Expression</label>

                                            <div id="scanMaskInfo" style=''>
                                                <span style="font-size: 11px;">Example:</span><span style="font-family: monospace; padding: 5px;"> 1-800-???-5555</span>
                                                <span class="lower_comment same">Note: The maximum length allowed is 100 characters. Leave pattern blank to match all barcodes. <a href="#" target="_blank">Learn More</a></span>
                                            </div>
                                            <div id="regexMaskInfo" style='display: none;'>
                                                <span style="font-size: 11px;">Example:</span><span style="font-family: monospace; padding: 5px;"> ^([0-9]{5})$</span>
                                                <span class="lower_comment same">Note: <a href="#">Contact Us</a> for help with custom regular expressions. <a href="#" target="_blank">Learn More</a></span>
                                            </div>

                                            <input type="text" name="maskRule" id="maskRule" class="word_count largeinput large" value="">
                                            <span class="counter" style=''></span>
                                            <br />

                                            <br />
                                            <label for="maskResponse" class="normal">Response</label>
                                            <textarea name="maskResponse" class="left small" id="maskResponse"></textarea>
                                            <div class="left seven_lg" id="maskOptions">
                                                <input type="checkbox" class="inputcheckbox" name="maskValidity" id="maskValidity" value="1" id="maskValidity">
                                                <label for="maskValidity" class="normal">
                                                    <img src="Images/invalid-small.png" alt=""><span>Force an invalid response when a scan match is made.</span></label>
                                                <br />
                                                <br />
                                                <input type="checkbox" class="inputcheckbox" name="maskInsert" id="maskInsert" value="1" id="maskInsert">
                                                <label for="maskInsert" class="normal">
                                                    <img src="Images/database16.png" alt=""><span>Add scanned value and response to the roster when a match is made.</span></label>
                                            </div>
                                            <br />
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <script>
                                $(document).ready(function () {
                                    activateDivRadioSet($("#showMaskRadioSet"));

                                    $("#newDatabaseNameA1, #newDatabaseNameA2").click(function (event) {
                                        $("#chooseADatabaseSpan").toggle();
                                        $("#newDatabaseNameInput").toggle();
                                        $("#newDatabaseNameA1").toggle();
                                        $("#newDatabaseNameA2").toggle();
                                        $("#newDatabaseNameFlag").attr('value', $("#newDatabaseNameFlag").attr('value') == 1 ? 0 : 1);
                                        return false;
                                    });


                                    $('.word_count').each(function () {
                                        var me = this, counter = $(this).parent().find('.counter'),
                                        assignLength = (function () {
                                            var l = $(me).val().length;
                                            counter.html('<strong ' + (l > 100 ? 'style="color: red;"' : '') + '>' + l + '</strong> Characters');
                                        });
                                        assignLength();
                                        $(this).keyup(assignLength);
                                    });

                                    $("#regexMask").click(function (event) {
                                        //if ($("#regexMask").is(":checked")) {
                                        $("#scanMaskInfo").toggle();
                                        $("#regexMaskInfo").toggle();
                                        $(".counter").toggle();
                                        $("#regexHeader").toggle();
                                        $("#patternHeader").toggle();
                                        //}
                                    });
                                });
                            </script>
                        </div>

                        <input name="servicetype" value="databasebuilder" type="radio" id="radioDatabaseBuilder" class="showradio" />
                        <label for="radioDatabaseBuilder">Roster Builder</label>
                        <span class="lower_comment">Populate your roster with scanned values. (<a href="#" target="_blank">Learn more here.</a>)</span>
                        <div class="showdiv">

                            <label>What database would you like to insert your scanned values into?</label>
                            <div class="indent2">
                                <span id="chooseADatabaseSpanB">
                                    <label for="database" style="display: inline;">Roster:</label>
                                    <select name="database" id="Select1" class="selectbox">
                                       <%-- <option selected disabled>Choose a Database</option>
                                        <option value="200223">Ticketing</option>
                                        <option value="200224">Database Builder Demo</option>
                                        <option value="200225">Security</option>
                                        <option value="200226">Asset Tracking</option>
                                        <option value="200227">Safety Status</option>
                                        <option value="200228">Attendance</option>
                                        <option value="200229">Scan to Order</option>
                                        <option value="205631">Dkumartest</option>
                                        <option value="209231">test12345</option>
                                        <option value="211223">newdb12345</option>
                                        <option value="211225">sadsadsad</option>--%>
                                        <%=this.GetDatabaseString() %>
                                    </select>
                                </span>
                                <span id="newDatabaseNameInputB" style="display: none;">
                                    <input type="hidden" class="inputed" id="newDatabaseDuplicateValue1" name="newDatabaseDuplicateValue" value="1" />
                                    <input type="hidden" class="inputed" id="newDatabaseNameFlagB" name="newDatabaseNameFlag2" value="0" />
                                    <label for="newDatabaseNameB" style="display: inline;">Enter new roster name:</label><br />
                                    <input type="text" class="inputed" id="newDatabaseNameB" name="newDatabaseName2" />
                                </span>
                                or 
	<a id="newDatabaseNameB1" href="">create a new one</a><a id="newDatabaseNameB2" href="#" style="display: none;">choose among existing</a>.
                            </div>


                            <script>
                                $(document).ready(function () {
                                    $("#newDatabaseNameB1, #newDatabaseNameB2").click(function (event) {
                                        $("#chooseADatabaseSpanB").toggle();
                                        $("#newDatabaseNameInputB").toggle();
                                        $("#newDatabaseNameB1").toggle();
                                        $("#newDatabaseNameB2").toggle();
                                        $("#newDatabaseNameFlagB").attr('value', $("#newDatabaseNameFlagB").attr('value') == 1 ? 0 : 1);
                                        return false;
                                    });
                                });
                            </script>
                        </div>

                        <input name="servicetype" value="postback" type="radio" id="radioPostback" class="showradio" />
                        <label for="radioPostback">Redirect Scans to a Third Party Server</label>
                        <span class="lower_comment">For advanced users - requires IT integration. (<a href="#" target="_blank">Learn more here.</a>)</span>
                        <div class="showdiv">
                            <label>Where would you like to send your scans?</label>
                            <div class="indent2">
                                <span class="lower_comment same">This URL will receive various scan parameters, such as barcode ID, device ID, service ID, etc. 
				<a href="#" target="blank">Test your Postback URL with our Testing Tool.</a>
                                </span>
                                <input type="text" class="inputed" name="postbackurl" />
                                <br />
                                <input name="postbackCheckbox" type="checkbox" disabled="disabled" />
                                <label for="postbackCheckbox" style="color: gray">Skip our server and go directly to yours. (For Paid Accounts Only)</label>
                            </div>
                        </div>

                        <input name="servicetype" value="webview" type="radio" id="radioWebview" class="showradio" />
                        <label for="radioWebview">View Web Content (no scanning)</label>
                        <span class="lower_comment">Use your own URL or enter HTML directly.  (<a href="#" target="_blank">Learn more here.</a>)</span>

                        <script>
                            $(document).ready(function () {
                                activateDivRadioSet($("#serviceRadioSet"));


                            });
                        </script>
                    </div>
                    <br />
                    <input type="submit" value="Create Button" class="black_button blarge" />
                </fieldset>
            </form>

        </div>
    </div>


</asp:Content>
